package com.zimmur.app.mocolink.domain.vo;

import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class GoodsForManageVo {
	
	private int pageNo = 1; // 当前页码
	private int totalRecord; // 总记录数量
	private int totalPage; // 总页数
	private Integer pageSize = 10; // 每页记录数
	private int nextPage; // 下一页
	private int prevPage; // 上一页
	private List<GoodsCategoryVo> categoryItemList = new ArrayList<>(); // 品类信息
	private List<GoodsBrandInfo> brandItemList = new ArrayList<>(); // 品牌信息
	private List<GoodsForManageInfo> goodsItemList = new ArrayList<>(); // 商品信息
	@JsonIgnore
	private int pageBeginNo; // 标记

	// 当前页码
	public int getPageNo() {
		if (pageNo < 1) {
			pageNo = 1;
		}
		return pageNo;
	}

	public void setPageNo(int pageNo) {

		this.pageNo = pageNo;
	}

	// 总记录条数
	public int getTotalRecord() {

		return totalRecord;
	}

	public void setTotalRecord(int totalRecord) {
		this.totalPage = (totalRecord % pageSize == 0 ? totalRecord / pageSize : (totalRecord / pageSize) + 1);
		this.totalRecord = totalRecord;
	}

	// 总页数
	public int getTotalPage() {
		return totalPage;
	}

	// 每页总记录条数
	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	// 下一页
	public int getNextPage() {
		if (pageNo >= getTotalPage()) {
			nextPage = getTotalPage();
		} else {
			nextPage = pageNo + 1;
		}
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	// 上一页
	public int getPrevPage() {
		if (getPageNo() <= 1) {
			prevPage = 1;
		} else {
			prevPage = getPageNo() - 1;
		}
		return prevPage;
	}

	public void setPrevPage(int prevPage) {
		this.prevPage = prevPage;
	}
	// 标记
	public int getPageBeginNo() {
		pageBeginNo = (getPageNo() - 1) * pageSize;
		return pageBeginNo;
	}

	public List<GoodsForManageInfo> getGoodsItemList() {
		return goodsItemList;
	}

	public void setGoodsItemList(List<GoodsForManageInfo> goodsItemList) {
		this.goodsItemList = goodsItemList;
	}

	public void setPageBeginNo(int pageBeginNo) {
		this.pageBeginNo = pageBeginNo;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	public List<GoodsBrandInfo> getBrandItemList() {
		return brandItemList;
	}

	public void setBrandItemList(List<GoodsBrandInfo> brandItemList) {
		this.brandItemList = brandItemList;
	}

	public List<GoodsCategoryVo> getCategoryItemList() {
		return categoryItemList;
	}

	public void setCategoryItemList(List<GoodsCategoryVo> categoryItemList) {
		this.categoryItemList = categoryItemList;
	}
}
